package com.welink.cmp.adapter.api.metadata.query;

import com.welink.cmp.dto.metadata.MetadataIdListQry;
import com.welink.cmp.dto.metadata.MetadataIdQry;
import com.welink.cmp.dto.metadata.eip.clientobject.EipCO;
import com.welink.cmp.dto.metadata.eip.query.EipListByPageQry;
import com.welink.cmp.meatdata.service.EipAppService;
import com.welink.common.dto.MultiResponse;
import com.welink.common.dto.PageResponse;
import com.welink.common.dto.SingleResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * EIP查询服务API
 *
 * @create
 */
@RestController("/api/eip/query")
public class EipQueryServiceApi {

    @Autowired
    private EipAppService eipAppService;

    /**
     * [ID查询]查询EIP信息详情
     * @param idQry 主键ID
     * @return Eip DTO
     */
    @GetMapping("/eip-item")
    public SingleResponse<EipCO> queryEipById(@RequestBody MetadataIdQry idQry){
        final EipCO eipById = eipAppService.getEipById(idQry.getId());
        return SingleResponse.of(eipById);
    }

    /**
     * [列表查询]列表查询EIP信息
     * @param listQuery 列表查询指令
     * @return Eip DTO列表
     */
    @GetMapping("/eip-list")
    public MultiResponse<EipCO> listQueryEip(@RequestBody MetadataIdListQry listQuery){

        return MultiResponse.of(null);
    }

    /**
     * [分页查询]分页查询EIP信息
     * @param pageQry 分页查询指令
     * @return Eip DTO分页结果
     */
    @GetMapping("/eip-page")
    public PageResponse<EipCO> pageQueryEip(@RequestBody EipListByPageQry pageQry){
        return eipAppService.eipPageQuery(pageQry);
    }
}